package com.demo.example;


import io.seata.core.context.RootContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

@Slf4j
@Service
public class TestServiceImp implements TestService {
    @Autowired
    private BusinessClient client;

    @Autowired
    private Test1Repository dao;
    @Transactional
    public int updateTest1(Test1 value) {
        System.out.println("xid:"+RootContext.getXID());
        client.businessMethod(value.getName());
        if(1==2)
            throw new RuntimeException("dddddddddddd");
        return dao.updateTest(value.getName(),value.getSex(),value.getId());
    }
}

